package com.rwx.reflect;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class Reflect07 {

    public static void main(String[] args) throws ClassNotFoundException,
            NoSuchMethodException,
            InvocationTargetException,
            InstantiationException, IllegalAccessException, NoSuchFieldException {

        Class clazz=Class.forName("com.rwx.reflect.model.Student");
        Constructor con1 = clazz.getConstructor();
        Object o = con1.newInstance();

        Method getStuInfo = clazz.getMethod("getStuInfo", String.class);
        String result= (String) getStuInfo.invoke(o,"aaaaa");
        System.out.println(result);

        System.out.println("=============================");
    }
}
